using System;
using System.Collections.Generic;
using MySql.Data.MySqlClient;
using System.Data;
using MySql.Data;

namespace DnDDB
{
    public class Armor : DnDDB.Equipment
    {

        // non-derived variables
        // non derived variables will have accessors and mutators
        // and add method as well


        int acBonus;
        int speed;
        int armorCheckPenalty; //not sure on type
        int enchantment;
        public Armor(string name)
            : base(name)
        {
            getMySQL get = new getMySQL();
            string dbCommand = "SELECT * FROM `Armor` a, `Equipment_is_Armor` eia, `Equipment` e WHERE " +
            "e.name = '" + name + "' AND eia.Equipment_id = e.id AND eia.Armor_id;";
            DataRow dt = get.GetMySQLFilledRow(dbCommand);
            this.acBonus = Convert.ToInt32(dt["ac"]);
            this.speed = Convert.ToInt32(dt["max_speed"]);
            this.armorCheckPenalty = Convert.ToInt32(dt["armor_check_penalty"]);
            this.enchantment = Convert.ToInt32(dt["enchantment"]);
        }

        public Armor(string name, bool equipped)
            : base(name, equipped)
        {
            getMySQL get = new getMySQL();
            string dbCommand = "SELECT * FROM `Armor` a, `Equipment_is_Armor` eia, `Equipment` e WHERE " +
            "e.name = '" + name + "' AND eia.Equipment_id = e.id AND eia.Armor_id;";
            DataRow dt = get.GetMySQLFilledRow(dbCommand);
            this.acBonus = Convert.ToInt32(dt["ac"]);
            this.speed = Convert.ToInt32(dt["max_speed"]);
            this.armorCheckPenalty = Convert.ToInt32(dt["armor_check_penalty"]);
            this.enchantment = Convert.ToInt32(dt["enchantment"]);
        }


        public Armor(string equip_name, int weight, int cost, int acBonus, int speed, int aCP, int enchantment)
            : base(equip_name, weight, cost, 0, false)
        {

            //base(equip_name,weight,cost);
            this.acBonus = acBonus;
            this.speed = speed;
            this.armorCheckPenalty = aCP;
            this.enchantment = enchantment;
            // set all the derived attributes		

        }

        public int getACbonus()
        {
            return acBonus;
        }
        public int getSpeed()
        {
            return speed;
        }
        public int getArmorCheckPenalty()
        {
            return armorCheckPenalty;
        }
        public void setACbonus(int bonus)
        {
            acBonus = bonus;
        }
        public void setSpeed(int newSpeed)
        {
            speed = newSpeed;
        }
        public void setArmorCheckPenalty(int newACP)
        {
            armorCheckPenalty = newACP;
        }
        public int getEnchantment()
        {
            return this.enchantment;
        }
        public void setEnchantment(int enchantment)
        {
            this.enchantment = enchantment;
        }

    }
	
}